<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of m_vendors
 *
 * @author Tuyet
 */
class M_vendors extends CI_Model {
    function __construct() {
        parent::__construct();
        $this->load->database();
        
    }
    function getallvendors(){
        $sql = $this->db->get('vendors');
        $result = $sql->result();
        return $result;
    }
    function getvendorid($company_name){
        $item = 0;
        $query = $this->db->get_where('vendors', array('company_name' => $company_name));
        foreach ($query->result() as $row) {
            $item = $row->vendor_id;
        }

        return $item;
    }
}

?>
